/**
 * 安卓白金英雄坛制作组 <br>
 * 文件名：ActionScreen.java <br>
 * 创建时间：2014-3-23 上午10:22 <br>
 * 所属项目：GmudTest <br>
 * @author ubun <br>
 */
package lostland.gmud.exv2.ui;

import lostland.gmud.exv2.Gmud;
import lostland.gmud.exv2.data.Room;
import lostland.gmud.exv2.expand.FlyingScreen;
import lostland.gmud.exv2.expand.MoreActionMenuScreen;
import lostland.gmud.exv2.ui.core.MenuScreen;

/**
 * 类名：ActionScreen <br>
 * 说明：功能菜单
 *
 * @author ubun
 */

public class ActionScreen extends MenuScreen {

	public ActionScreen() {
		super(new ActionButton[]{
				new ActionButton(0),
				new ActionButton(1),
				new ActionButton(2),
				new ActionButton(3)
		});
		dummyBorder = new ActionBorder();

	}

	@Override
	protected void onClick(int index) {
		switch (index) {
			case 0:
				new InnerMenuScreen().pushToGame();
				break;
			case 1:
				if(Gmud.mc.getHp() < Gmud.mc.getAttr(Room.ATTR_MAXHP)) {
					new NotificationScreen("你受伤了，还是先治疗要紧！").pushToGame();
				} else {
					int n = 0;
					if (Gmud.mc.skillsckd[0] > 10) {
						n++;
					}
					if (Gmud.mc.skillsckd[1] > 10) {
						n++;
					}
					if (Gmud.mc.skillsckd[2] > 10) {
						n++;
					}

					if (n > 0) {
						new PracticeMenuScreen().pushToGame();
					}
				}
				break;
			case 2:
				FlyingScreen.fly();
				break;
			case 3:
				new MoreActionMenuScreen().pushToGame();
				break;
		}
	}

	@Override
	public void onCancel() {
		getGame().popScreen();
	}

	@Override
	protected void show() {
//		game.getParentScreen().present(-1);
		dummyBorder.draw();
		for (int i = 0; i < 4; i++) {
			buttons[i].draw();
		}
	}
	/*
	@Override
	protected void onButtonDown(NewButton b) {
		if(b == NewButton.NB_ENTER)
		{
			if(cursor == 1)
				SingleTouchHandler.flag = 10;
		}
		super.onButtonDown(b);
	}*/
}
